﻿namespace EmbeddedSharp.Core {
    public class UnaryFunctionTranslator
        : CSharpCodeTranslator {

        protected string subject = string.Empty;

        public UnaryFunctionTranslator(
            IFunctionManager funMgr, string subject)
            : base(funMgr) {
            this.subject = subject;
        }

        #region IZoveNumericsVisitor Members

        public override object Visit(IdentifierNode node) {
            if (this.subject == node.Value) {
                return "x";
            }

            return node.Value;
        }

        #endregion
    }
}
